package com.qky.util;

import java.util.List;

public class PageUtil {
    public PageUtil(int pageIndex,int pageSize, int totalRow){//当前页,每页多少条,共多少条记录
        this.pageIndex=pageIndex;
        this.totalRow=totalRow;
        this.pageSize=pageSize;
        totalPages=totalRow%pageSize==0?totalRow/pageSize:totalRow/pageSize+1;
        if (pageIndex<=1) {
            next=pageIndex+1;
            prev=1;
        }else if (pageIndex>=totalPages) {
            next=totalPages;
            prev=pageIndex-1;
        }else{
            next=pageIndex+1;
            prev=pageIndex-1;
        }
    }
    private List plist;//数据集合
    private int totalPages;//共多少页
    private int totalRow;//总记录数
    private int pageSize;//每页数量
    private int pageIndex;//当前页
    private int prev;//上一页
    private int next;//下一页
    
    public void setPlist(List plist) {
    	this.plist = plist;
    }
    public List getPlist() {
		return plist;
	}
	public int getTotalPages() {
		return totalPages;
	}
	public int getTotalRow() {
		return totalRow;
	}
	public int getPageSize() {
		return pageSize;
	}
	public int getPageIndex() {
		return pageIndex;
	}
	public int getPrev() {
		return prev;
	}
	public int getNext() {
		return next;
	}
}
